﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace DefeatEpidemic.Migrations
{
    public partial class AddManager : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Managers",
                columns: table => new
                {
                    id = table.Column<Guid>(nullable: false),
                    name = table.Column<string>(nullable: true),
                    mobile = table.Column<string>(nullable: true),
                    idcard = table.Column<string>(nullable: true),
                    address = table.Column<string>(nullable: true),
                    created_at = table.Column<DateTime>(nullable: false),
                    communityid = table.Column<Guid>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Managers", x => x.id);
                    table.ForeignKey(
                        name: "FK_Managers_Community_communityid",
                        column: x => x.communityid,
                        principalTable: "Community",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateIndex(
                name: "IX_Managers_communityid",
                table: "Managers",
                column: "communityid");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Managers");
        }
    }
}
